package cn.lyq.card.ui.customer

import android.view.View
import cn.lyq.card.R
import cn.lyq.card.base.BaseDialogFg
import cn.lyq.card.utils.setClick
import com.blankj.utilcode.util.ClipboardUtils
import com.blankj.utilcode.util.PhoneUtils
import com.blankj.utilcode.util.ToastUtils
import kotlinx.android.synthetic.main.dialog_customer_service_phone.*


class CustomerSPhoneFg(override val rootId: Int = R.layout.dialog_customer_service_phone) :
    BaseDialogFg() {

    private val phone by lazy {
        getString(R.string.str_customer_service_phone)
    }

    override fun initListener(view: View) {
        super.initListener(view)
        tvCancel.setClick {
            ClipboardUtils.copyText(phone)
            dismiss()
            ToastUtils.showShort(getString(R.string.str_copy_success))
        }
        tvPhone.setClick {
            ClipboardUtils.copyText(phone)
            ToastUtils.showShort(getString(R.string.str_copy_success))
        }
        tvConfirm.setClick {
            PhoneUtils.dial(phone)
            dismiss()
        }
    }
}